<template>
  <div :class="['activity-desc', $ua.isFromPc() ? 'z-web' : 'z-phone']">
    <img fit="cover" class="image" :src="result.title_page" />
    <div class="activity-desc-menu">
      <div :class="['content', 'all-center', index == active ? 'active' : '']" v-for="(item, index) in menuList" :key="index" @click="handleMenu(index)">
        {{ item }}
      </div>
    </div>
    <div class="menu-content-box">
      <ActivityIntroduce :result="result" v-show="active == 0" />
      <AboutWorks v-show="active == 1" />
      <AboutArticle v-show="active == 2" />
      <ActivityCollect v-show="active == 3" />
      <AboutVideo v-show="active == 4" />
    </div>
  </div>
</template>

<script>
import ActivityIntroduce from './components/activityIntroduce.vue'
import AboutArticle from './components/aboutArticle.vue'
import ActivityCollect from './components/activityCollect'
import AboutVideo from './components/aboutVideo'
import AboutWorks from './components/aboutWorks'
export default {
  name: '',
  components: {
    ActivityIntroduce,
    AboutArticle,
    ActivityCollect,
    AboutVideo,
    AboutWorks
  },
  props: {},
  data () {
    return {
      menuList: [
        '活动简介',
        '活动作品',
        '专题文章',
        '活动集锦',
        '活动视频'
      ],
      result: {},
      active: 0
    }
  },
  computed: {},
  watch: {},
  created () {},
  mounted () {
    this.getActivityDesc()
  },
  methods: {
    handleMenu(index) {
      this.active = index
    },
    getActivityDesc() {
      this.$api.getActivityDesc({ data_id: this.$route.query.data_id }).then(res => {
        if (res.status == '$SUCCESS') {
          this.result = res.result
          // this.result.picture_list = Array.isArray(this.result.picture_list) && this.result.picture_list ? this.result.picture_list : []
          console.log('this.result.picture_list', this.result)
        }
      })
    }
  }
}
</script>

<style scoped lang="less">
.activity-desc {
  &.z-web {
    background: #fff;
    padding: 0 0 80px;

    .image {
      width: 100%;
      height: 600px;
      object-fit: cover;
    }

    .activity-desc-menu {
      text-align: center;
      margin-bottom: 50px;

      .content {
        display: inline-flex;
        width: 273px;
        height: 60px;
        background: #00A784;
        cursor: pointer;
        font-size: 24px;
        font-weight: 600;
        color: #000;
        line-height: 48px;

        &.active {
          background: #FF5C01;
        }
      }
    }

    .menu-content-box {
      padding: 0 268px;
    }
  }

  &.z-phone {
    margin-top: pxtorem(88) !important;

    .image {
      width: 100%;
      height: pxtorem(365);
      object-fit: cover;
    }

    .activity-desc-menu {
      .content {
        width: pxtorem(150);
        height: pxtorem(88);
        background-color: #00A784;

        &.active {
          background-color: #FF5C01;
        }
      }
    }
  }
}
</style>
